<?php get_header(); ?>
<div id="container">
<div id="content">
	<div id="postlist">
	<?php if(have_posts()) : while (have_posts()) : the_post(); ?>
    <div class="content_text"> 

	<div id="post-path"><a rel="nofollow" title="Go to homepage" href="<?php //echo home_url(); ?>http://www.oparan.com/">Home</a> &raquo; <?php $category=get_the_category($post->ID); echo (get_category_parents($category[0]->term_id, TRUE, ' &raquo; ')); ?> <?php the_title(); ?></div>

    <div class="title"> 
    <a href="<?php the_author_meta('user_url'); ?>" class="avatar"><?php echo get_avatar( get_the_author_meta('user_email'), '43', '' ); ?>"<span><?php echo get_avatar( get_the_author_meta('user_email'), '43', '' ); ?>"</span></a> 
    <i class="line_h"></i> 
    <h3><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3> 
    <p><?php the_author_posts_link(); ?> / <?php the_category(',') ?> / 浏览:<?php if(function_exists('the_views')) { the_views(); } ?> / <?php the_time('Y年m月d日'); ?></p> 
    <span class="comments"><?php comments_popup_link('0', '1', '%', 'up'); ?></span>
    </div> 
    <!--content_banner--> 
    <div class="content_banner"> 
    

	<?php get_img_link($post); ?>

    <div class="text">
    <?php the_content(); ?>
    </div> 
	</div>
	<div class="toolbar">
	<li>相关标签：<?php the_tags('', ' ', ''); ?></li>
	</div>
   <div id="scrollbox">
	<ul>
		<?php
		$limit_num = '20';
		$time = '1 MONTH';
		$noneurl = '/';
		$my_email = "'" . get_bloginfo ('admin_email') . "'";
		$counts = $wpdb->get_results("
			SELECT COUNT(comment_author) AS cnt, comment_author, comment_author_url, comment_author_email
			FROM (SELECT * FROM $wpdb->comments LEFT OUTER JOIN $wpdb->posts
			ON ($wpdb->posts.ID=$wpdb->comments.comment_post_ID)
			WHERE comment_date > date_sub( NOW(), INTERVAL $time )
			AND comment_author_email != $my_email
			AND post_password=''
			AND comment_approved='1'
			AND comment_type='') AS tempcmt	GROUP BY comment_author_email
			ORDER BY cnt DESC LIMIT $limit_num
		");
		if(empty($counts)) { echo '<li style="line-height:22px;">none data.</li>'; return; }
		$mostactive = '';
		foreach ($counts as $count) {
			$c_url = $count->comment_author_url;
			if ($c_url == '') $c_url = $noneurl;
			$title_alt = $count->comment_author . ' ('. $count->cnt. ' comments)';
			$mostactive .= '<li>' . '<a rel="external nofollow" href="'. $c_url . '" title="' .$title_alt
			. '">'.get_avatar($count->comment_author_email,$size='40',$default='').'</a></li>';
		}
		echo $mostactive;
		?>
	</ul>
</div>

</div>
	<?php endwhile; endif; ?>
	<div id="comments" class="comments"><?php comments_template('', true); ?></div>
	</div></div>
<?php get_sidebar(); ?>
</div>
<?php get_footer(); ?>